<?php

namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Request;

class SysMp3  extends Base
{
    public function __construct(){
        parent::__construct();
        $this->user=session('user');
    }
    //获取系统音频
    public function getSysMp3($name='',$type='',$pageNum=1,$pageSize=20)
    {
        $where=[];
        if($name!=''){
            $where['name']=['like','%'.$name.'%'];
        }
        if($type!=''){
            $where['type']=$type;
        }

        $data = Db::name('mp3')->where($where)->page($pageNum,$pageSize)->select();
        $count = Db::name('mp3')->where($where)->count();

        return json(['code'=>200,'msg'=>'成功','data'=>$data,'count'=>$count,'success'=>true]);
    }
}